<!--# layout("/common/mallout.html",{"jsBase":"/js/order/settlement/"}){ -->

<link rel="stylesheet" href="https://ziyunoss.oss-cn-hangzhou.aliyuncs.com/pop%2Fmall%2Fstyle%2Fgallery.css">
<div style="background:#FFFFFF; overflow:hidden;">

    <script type="text/html" id="factoryView">
        <div class="gc_title"><span>工厂列表</span><i>> {{productVO['productName']}}</i></div>
        <div class="gc_hd">
            {{each  productVO['productInfoParamList'] info}}
            <p>
                <label>{{info['partsName']}}</label>
            {{each info['basicParam'] param key}}
                <em>{{key}}:{{param}}</em>
            {{/each}}

            </p>
            {{/each}}
        </div>
        <div class="gc_bd">
            <table>
                <thead>
                <tr>
                    <td width="10%">供应商图片</td>
                    <td width="12%">商家名称</td>
                    <td width="24%">联系方式及地址</td>
                    <td width="10%">配送范围</td>
                    <td width="10%">特色</td>
                    <!--<td width="15%">价格详情</td>-->
                    <td width="10%">价格</td>
                    <td width="15%">操作</td>
                </tr>
                </thead>

                {{each factoryQuoteInfos as factoryInfo}}
                <tbody>
                <tr>
                    <td>
                        	<span>
                                {{if factoryInfo['factoryInfoVO']['url'] == null}}
                            	<img src="${imagepath}/pop/mall/image/pic_pop_01.png">
                                {{else}}
                            	<img src="${imagepath}/{{factoryInfo['factoryInfoVO']['url']}}">
                                {{/if}}
                            </span>
                    </td>
                    <td>
                        <span><strong>{{factoryInfo['factoryInfoVO']['factoryName']}}</strong></span>
                    </td>
                    <td style="padding-left: 40px;">
                        <p>
                            <span>姓名：</span>
                            <i>{{factoryInfo['factoryInfoVO']['contacts']}}</i>
                        </p>
                        <p>
                            <span>QQ：</span>
                            <i>{{factoryInfo['factoryInfoVO']['qq']}}</i>
                        </p>
                        <p>
                            <span>联系方式：</span>
                            <i>{{factoryInfo['factoryInfoVO']['contactWay']}}</i>
                        </p>
                        <p>
                            <span>联系地址：</span>
                            <i>{{factoryInfo['factoryInfoVO']['address']}} </i>
                        </p>
                    </td>
                    <td>
                        <span>全国</span>
                    </td>
                    <td>
                        <span>包邮、安装费</span>
                    </td>
                    <!--<td>-->
                        <!--<a href="javascript:;" style="margin-top: 20px;" priceDetail="{{factoryInfo['priceProcess']}}" paperInfoStr="{{factoryInfo['paperInfoStr']}}"  quantity="{{productVO['quantity']}}" target="_blank" class="priceDetail sub_but">价格明细</a>-->
                    <!--</td>-->
                    <td>
                        <em>￥<font>{{factoryInfo['totalPrice']}}</font></em>
                    </td>
                    <td>
                        <a href="javascript:;" id="{{factoryInfo['factoryInfoVO']['id']}}" goodsId="{{factoryInfo['factoryInfoVO']['goodsId']}}" goodsType="{{factoryInfo['factoryInfoVO']['goodsType']}}"  target="_blank" class="buynow sub_but">立即购买</a>
                        <br>
                        <span href="javascript:;" style="cursor: pointer;"  id="{{factoryInfo['factoryInfoVO']['id']}}" goodsId="{{factoryInfo['factoryInfoVO']['goodsId']}}" goodsType="{{factoryInfo['factoryInfoVO']['goodsType']}}" class="addcart sub_but">加入购物车</span>
                    </td>
                </tr>
                </tbody>
                {{/each}}
            </table>
        </div>
    </script>

    <div class="gongchang_view">
        <div class="gongchang_view">
            <div class="gc_title"><span>工厂列表</span><i>&gt; 定制手提袋</i></div>
            <div class="gc_hd">
                <p>
                    <label>报 价 商 品</label>
                    <em>成品尺寸:340（高）*220（宽）*65（厚）</em>
                    <em>是否自来纸:否</em>
                    <em>数量:1000</em>
                    <em>颜色:彩色</em>
                    <em>材料:白卡 230克</em>
                    <em>粘袋方式:正反内容相同</em>
                </p>
            </div>
            <div class="gc_bd">
                <table>
                    <thead>
                    <tr>
                        <td width="10%">供应商图片</td>
                        <td width="12%">商家名称</td>
                        <td width="24%">联系方式及地址</td>
                        <td width="10%">配送范围</td>
                        <td width="10%">特色</td>
                        <td width="15%">价格详情</td>
                        <td width="10%">价格</td>
                        <td width="15%">操作</td>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>

</div>


<script type="text/html" id="priceDetail">


</script>

<!--#} -->

<script>

    doAjax("/quote/findFactory.json","post",{},function (ret) {
        var html = template("factoryView",ret.data);
        $("div.gongchang_view").html(html);
    });

    var addCartDto = {};
    //加入购物车
    $(document).on("click",".addcart",function () {
        addCartDto['shopId'] = $(this).attr('id');
        addCartDto['goodsType'] = $(this).attr('goodsType');
        addCartDto['id'] = $(this).attr('goodsId');
        doAjax("/quote/quoteAddCart.do","post",{"addCartDto":JSON.stringify(addCartDto)},function (ret) {
           if(ret.code == 1){
               $.alert("success","添加成功",0.5);
           }else{
               $.alert("error",ret.message,0.5);
           }
        });
    })
     //立即购买
    $(document).on("click",".buynow",function () {
    	 if($(this).hasClass('alreadyClicked')){
			 return;	
		 }
    	$(this).addClass('alreadyClicked');
        addCartDto['shopId'] = $(this).attr('id');
        addCartDto['goodsType'] = $(this).attr('goodsType');
        addCartDto['id'] = $(this).attr('goodsId');
    	 doAjax("/order/popGoDown/bjRedirectIndex.json","post",{"addCartDto":JSON.stringify(addCartDto)},function (ret) {
    		 if(ret.code=="200"){
                 var url="/order/popGoDown/index.do";
                 location.href = url;
             }else{
          	   //返回错误页面
          	   alert()
             }
        });
    });

    $(document).on('click','.priceDetail',function () {
        var paperInfoStr = $.parseJSON($(this).attr("paperInfoStr"));
        priceDetail($(this).attr("priceDetail"));
    })
    // //设计商品弹出框
    // function priceDetail(obj){
    //     var res = "<div>"+JSON.stringify(obj)+"</div>";
    //     $.prompt({
    //         style: 'width:900px;left:450px',
    //         title: '算价过程',
    //         con: res,
    //     });
    // }

</script>